{% extends 'blog/base.html' %}

{% block title %}博客首页{% endblock %}

{% block content %}

    <div class="container">
        <div class="row">
            <div class="col-md-9">
                {% for entry in entry_list %}
                    <h2><a href="{{ entry.get_absolute_url }}">{{ entry.title }}</a></h2> <br>
                    {% if entry.img %}
                        <img src="{{ entry.img.url }}" width="60%" height="270px"/>
                    {% endif %}
                    {% if entry.abstract %}
                        <p>{{ entry.abstract }}</p>
                    {% else %}
                        <p>{{ entry.body|truncatechars:100 }}</p>
                    {% endif %}
                    <p>
                        <span>作者：{{ entry.author }}</span>
                        <span>&nbsp;&nbsp;&nbsp;&nbsp;发布时间：{{ entry.created_time }}</span>
                        <span>&nbsp;&nbsp;&nbsp;&nbsp;阅读数：{{ entry.visiting }}</span>
                    </p>
                {% endfor %}
                <hr/>

                <!--/.pagination-->
                <div id="paginator" class="pull-right">
                    <ul class="pagination">
                        {% if entry_list.has_previous %}
                            <li><a href="?page={{ entry_list.previous_page_number }}"><i
                                    class="glyphicon glyphicon-chevron-left"></i>前一页</a></li>
                        {% endif %}

                        {% if first %}
                            <li><a href="?page=1">1</a></li>
                        {% endif %}

                        {% if left %}
                            {% if left_has_more %}
                                <span>...</span>
                            {% endif %}

                            {% for i in left %}
                                <li><a href="?page={{ i }}">{{ i }}</a></li>
                            {% endfor %}
                        {% endif %}

                        <li class="active"><a href="?page={{ entry_list.number }}">{{ entry_list.number }}</a></li>

                        {% if right %}
                            {% for i in right %}
                                <li><a href="?page={{ i }}">{{ i }}</a></li>
                            {% endfor %}

                            {% if right_has_more %}
                                <span>...</span>
                            {% endif %}
                        {% endif %}

                        {% if last %}
                            <li><a href="?page={{ entry_list.num_pages }}">{{ entry_list.num_pages }}</a></li>
                        {% endif %}

                        {% if entry_list.has_next %}
                            <li><a href="?page={{ entry_list.next_page_number }}">下一页<i
                                    class="glyphicon glyphicon-chevron-right"></i></a></li>
                        {% endif %}
                    </ul>
                </div>
            </div>

            <div class="col-md-3">
                {% include 'blog/right_site_bar.html' %}
            </div>
        </div>
    </div>
{% endblock %}